<?php

/**
 * Description of VirtualLabs_Rest_VirtualLabs_Template
 *
 * @author markos
 */
class VirtualLabs_Rest_VirtualLabs_Offerings {

    private $_debug_log;
    private $_error_log;

    public function __construct() {
        $this->_error_log = Zend_Registry::get(VirtualLabs_Common::ERROR_LOG);
        $this->_debug_log = Zend_Registry::get(VirtualLabs_Common::DEBUG_LOG);
    }

    //put your code here
    public function listServiceOfferings() {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "listServiceOfferings";
        $v = new VirtualLabs_Rest_HttpClient_Client();
        try {
            $response = $v->call($url);
            $listServiceOfferingsResponse = Zend_Json_Decoder::decode($response);
            return $listServiceOfferingsResponse;
        } catch (Exception $e) {
            $this->_error_log->err($e->getTraceAsString);
            throw $e;
        }
    }

    public function listServiceOfferingById($id) {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "listServiceOfferings";
        $url["id"] = $id;
        $v = new VirtualLabs_Rest_HttpClient_Client();
        try {
            $response = $v->call($url);
            $listServiceOfferingsResponse = Zend_Json_Decoder::decode($response);
            return $listServiceOfferingsResponse;
        } catch (Exception $e) {
            $this->_error_log->err($e->getTraceAsString);
            throw $e;
        }
    }

    public function listDiskOfferings() {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "listDiskOfferings";
        $v = new VirtualLabs_Rest_HttpClient_Client();
        try {
            $response = $v->call($url);
            $listDiskOfferingsResponse = Zend_Json_Decoder::decode($response);
            return $listDiskOfferingsResponse;
        } catch (Exception $e) {
            $this->_error_log->err($e->getTraceAsString);
            throw $e;
        }
    }

}

?>
